package com.nineclock.system.controller;

import com.nineclock.common.entity.Result;
import com.nineclock.system.api.SysCompanyControllerApi;
import com.nineclock.system.dto.SysCompanyDTO;
import com.nineclock.system.pojo.SysCompany;
import com.nineclock.system.service.SysCompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


@RestController
@RequestMapping("/company")
public class SysCompanyController implements SysCompanyControllerApi {

    @Autowired
    private SysCompanyService sysCompanyService;


    //查询企业基本信息
    @GetMapping
    public Result find() {
        SysCompany sysCompany = sysCompanyService.findList();
        return Result.success(sysCompany);
    }



    //图片上传
    @PostMapping("/uploadOSS")
    public Result uploadOSS(MultipartFile file){

        return  sysCompanyService.uploadOSS(file);
    }


    @PutMapping
    public Result update(@RequestBody SysCompanyDTO dto){
        return sysCompanyService.update(dto);
    }
}
